require('./bootstrap');

window.Vue = require('vue');

import store from './store/index'
import jwtToken from './helpers/jwt'
import App from './components/App'
import zh_CN from './locale/zh_CN';

import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";
import iView from "iview";
import "iview/dist/styles/iview.css";
import VueAwesomeSwiper from 'vue-awesome-swiper'
import VueRouter from "vue-router";
import router from "./routes";
import MetaInfo from "vue-meta-info";
import 'swiper/dist/css/swiper.css'//（如果你使用的是2.6.0以上的版本要自己手动去加载css）
import preview from "vue-photo-preview";
import "vue-photo-preview/dist/skin.css";
import VeeValidate, {Validator} from 'vee-validate';

import WXConfig from "./wx.jsapi";//微信分享

// import ba from "vue-ba";


// const PrerenderSpaPlugin = require("prerender-spa-plugin");

axios.interceptors.request.use(function (config) {
    if (jwtToken.getToken()) {
        config.headers['Authorization'] = 'Bearer ' + jwtToken.getToken();
    }
    return config;
}, function (error) {
    // Do something with request error
    return Promise.reject(error);
});
Vue.prototype.WXConfig = WXConfig;//微信分享
Vue.config.productionTip = false;
Validator.addLocale(zh_CN);
Vue.use(VueAwesomeSwiper);
Vue.use(ElementUI);
Vue.use(iView);
Vue.use(preview);
Vue.use(VueRouter)
Vue.use(MetaInfo);
Vue.use(VeeValidate, {
  locale: "zh_CN",
  errorBagName: "errorBags", // change if property conflicts.
  fieldsBagName: "fieldBags"
});

/* Vue.use(ba, "e5bbf38a0ac77c2c6630a3a3667b0015");
Vue.use(ba, { siteId: "e5bbf38a0ac77c2c6630a3a3667b0015" }); */

Vue.component('app', App)

 var vm = new Vue({
    el: '#app',
    router,
    store,
    render: h => h(App),
});

export default {
    data:{
        'appPaths': appPath
    }
  
};